package com.yjs.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import com.yjs.bean.History;
import com.yjs.service.HistoryService;

import java.util.List;

/**
 * @author yjs
 * @create 2020-09-22-11:31
 * 历史记录controller层
 */
@Controller
public class HistoryController {

    //注入历史记录service层
    @Autowired
    HistoryService historyService;

    //查询所有的历史记录并返回
    @GetMapping("/history")
    public String history(Model model){
        List<History> allHistorys = historyService.getAllHistory();
        model.addAttribute("allHistorys",allHistorys);
        return "/history/history";
    }

}
